package com.magicsoft.share.ui.main;

import android.content.Intent;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;

import com.magicsoft.share.R;
import com.magicsoft.share.constant.Constant;
import com.magicsoft.share.base.BaseActivity;
import com.magicsoft.share.base.BasePresenter;
import com.magicsoft.share.utils.AlerterUtils;
import com.magicsoft.share.utils.Validator;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * @author lyf
 */
public class RegisterActivity extends BaseActivity {

    @BindView(R.id.ibtn_back)
    ImageButton ibtnBack;
    @BindView(R.id.iv_logo)
    ImageView ivLogo;
    @BindView(R.id.tv_mobile)
    TextView tvMobile;
    @BindView(R.id.edt_mobile)
    EditText edtMobile;
    @BindView(R.id.btn_next)
    Button btnNext;
    @BindView(R.id.tv_clause)
    TextView tvClause;
    @BindView(R.id.tv_policy)
    TextView tvPolicy;
    private String mobileStr;

    @Override
    public BasePresenter initPresenter() {
        return null;
    }

    @Override
    public int getLayoutId() {
        return R.layout.activity_register;
    }

    @Override
    public void initView() {

    }

    @Override
    public void initData() {

    }

    @Override
    public void requestData() {

    }

    @OnClick({R.id.ibtn_back, R.id.btn_next, R.id.tv_clause, R.id.tv_policy})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.ibtn_back:
                finish();
                break;
            case R.id.btn_next:
                mobileStr = edtMobile.getText().toString();
                if (TextUtils.isEmpty(mobileStr)) {
                    AlerterUtils.warning(this,"请输入手机号");
                } else if (!Validator.isMobile(mobileStr)) {
                    AlerterUtils.warning(this,"请输入正确的手机号");
                } else {
                    Intent intent = new Intent(this,SMSVerificationActivity.class);
                    intent.putExtra("mobile",mobileStr);
                    intent.putExtra("inputPasswordType", Constant.INPUT_PASSWORD_FIRST);
                    startActivity(intent);
                    finish();
                }
                break;
            case R.id.tv_clause:
                //条款
                break;
            case R.id.tv_policy:
                //政策
                break;
            default:
                break;
        }
    }
}
